age = float(input())
rest_heart_rate = float(input())
gender = input()
if gender == "male":
    min_rate = (220 - age - rest_heart_rate) * 0.6 + rest_heart_rate
    max_rate = (220 - age - rest_heart_rate) * 0.8 + rest_heart_rate
else:
    min_rate = (210 - age - rest_heart_rate) * 0.6 + rest_heart_rate
    max_rate = (210 - age - rest_heart_rate) * 0.8 + rest_heart_rate
print(f"{min_rate:.1f}~{max_rate:.1f}")